﻿// JScript File
 var array = new Array();
     array = Cookie.Get('treeview');
     var array2 = new Array();
     var valor = new String();
    if(array != null)
    {
      for (i = 0;i < array.length; i++)
      {
        if(array.toString().charAt(i) != ',')
            valor += array.toString().charAt(i).toString();
        else
            {
                array2.push(valor.toString());
                valor = '';
            }
      }
      if(valor != '')
        array2.push(valor);
      for (i = 0;i < array2.length; i++)
          {
                if(array2[i] != '')
                {
                    var div = document.getElementById(array2[i]);
                    if(div != null)
                    {
                        div.style.display = 'block';
                        var nomeicone = new String();
                        nomeicone = div.id;
                        nomeicone = nomeicone.replace('div','icone');
                        var icone = document.getElementById(nomeicone);
                        if(icone != null)
                            icone.src = iconecollapse;
                    }
                }
          }
      }
          
          function Remove(id)
          {
                 if(array2.length > 0)
                  {
                    for (i = 0;i < array2.length; i++)
                      {
                        if(array2[i] == id)
                        {
                            array2.splice(i,1);
                        }
                            
                      }
                  }
                   Cookie.Set('treeview',array2.toString());
          }
          function Add(id)
          {
            array2.push(id);
            Cookie.Set('treeview',array2.toString());
          }

